home *** CD-ROM | disk | FTP | other *** search
/ InfoMagic Internet Tools 1995 April / Internet Tools.iso / applic / ntp / depredated / ntp.3.4 / patches / patch9.Z / patch9
Encoding:
Text File  |  1991-09-29  |  12.3 KB  |  439 lines

  1.     He're the pre-IETF version of NTP.  You'll have a whole week to play
  2. with this version before I get back from the IETF meeting in sunny Florida.
  3.  
  4. louie
  5.  
  6. System: ntp version 3.4
  7. Patch #: 9
  8. Priority: 
  9.  
  10. From:
  11.  
  12. Description:
  13. Add dependency for ntpd.o on ntp.h so things sorta work even without doing a
  14. "make depend".  Trash "ci" rule.
  15.  
  16. Provide default value for number of bits/byte if not defined.  Compute the
  17. Window shift mask inside of conditional code on XTAL so we get the correct
  18. value if configured without a crystal controled clock (!!)
  19.  
  20. New -l option for ntpd to enable logging for clock adjust messages.  Changed
  21. our idea of a bogus packet in the packet procedure to include a packet received
  22. before a poll is sent.  Fix stupid bug in delay computation having to do with
  23. peer->precision.
  24.  
  25. NOTE: TO GET THE STATISTICS NEEDED TO USE THE stat.pl SCRIPT, YOU MUST SPECIFY
  26. THE -l OPTION WHEN INVOKING ntpd.
  27.  
  28.  
  29. Repeat-By:
  30.  
  31. Fix:    Grab the new /pub/ntp.3.4/ntp-test.tar.Z file or apply this patch:
  32.     From rn, say "| patch -p -N -d DIR", where DIR is your ntp source
  33.     directory.  Outside of rn, say "cd DIR; patch -p -N <thisarticle".
  34.     If you don't have the patch program, apply the following by hand,
  35.     or get patch (version 2.0, latest patchlevel).
  36.  
  37.     After patching:
  38.         make depend
  39.         make
  40.         make install
  41.  
  42.     If patch indicates that patchlevel is the wrong version, you may need
  43.     to apply one or more previous patches, or the patch may already
  44.     have been applied.  See the patchlevel.h file to find out what has or
  45.     has not been applied.  In any event, don't continue with the patch.
  46.  
  47.     If you are missing previous patches they can be obtained from me:
  48.  
  49.     Louis A. Mamakos
  50.     louie@trantor.umd.edu
  51.  
  52.     You can also get the patches via anonymous FTP from
  53.     trantor.umd.edu.
  54.  
  55. Index: patchlevel.h
  56. Prereq: 8
  57. 1c1
  58. < #define PATCHLEVEL 8
  59. ---
  60. > #define PATCHLEVEL 9
  61.  
  62. Index: Makefile
  63. *** Makefile.old    Mon Apr 10 15:58:54 1989
  64. --- Makefile    Mon Apr 10 15:58:54 1989
  65. ***************
  66. *** 1,6 ****
  67. ! # $Source: /usr/users/louie/ntp/RCS/Makefile,v $ $Revision: 3.4.1.4 $ $Date: 89/04/07 18:04:14 $
  68.   #
  69.   # $Log:    Makefile,v $
  70.   # Revision 3.4.1.4  89/04/07  18:04:14  louie
  71.   # Add definition of NOSWAP for Ultrix systems.
  72.   # 
  73. --- 1,10 ----
  74. ! # $Source: /usr/users/louie/ntp/RCS/Makefile,v $ $Revision: 3.4.1.5 $ $Date: 89/04/10 15:54:19 $
  75.   #
  76.   # $Log:    Makefile,v $
  77. + # Revision 3.4.1.5  89/04/10  15:54:19  louie
  78. + # Add dependency for ntpd.o on ntp.h so things sorta work even without doing a
  79. + # "make depend".  Trash "ci" rule.
  80. + # 
  81.   # Revision 3.4.1.4  89/04/07  18:04:14  louie
  82.   # Add definition of NOSWAP for Ultrix systems.
  83.   # 
  84. ***************
  85. *** 136,144 ****
  86.       ${CC} ${LDFLAGS} -DTEST -o sock_test ntp_sock.c ${LIBS}
  87.   
  88.   ${OBJS}:    ntp.h Makefile
  89. ! ci:
  90. !     ci -u Makefile README ${SRCS} ${HDRS} ntp.conf test.c extract.pl stat.pl
  91.   
  92.   install: ${DESTDIR}${BINDIR}/ntpd ${DESTDIR}${BINDIR}/ntp ${DESTDIR}${BINDIR}/ntpdc ntest
  93.       @./ntest
  94. --- 140,146 ----
  95.       ${CC} ${LDFLAGS} -DTEST -o sock_test ntp_sock.c ${LIBS}
  96.   
  97.   ${OBJS}:    ntp.h Makefile
  98. ! ntpd.o:    patchlevel.h
  99.   
  100.   install: ${DESTDIR}${BINDIR}/ntpd ${DESTDIR}${BINDIR}/ntp ${DESTDIR}${BINDIR}/ntpdc ntest
  101.       @./ntest
  102.  
  103. Index: ntp.h
  104. *** ntp.h.old    Mon Apr 10 15:58:59 1989
  105. --- ntp.h    Mon Apr 10 15:59:01 1989
  106. ***************
  107. *** 1,7 ****
  108. ! /* $Source: /usr/users/louie/ntp/RCS/ntp.h,v $ $Revision: 3.4.1.4 $ $Date: 89/03/31 16:34:50 $ */
  109.   
  110.   /*
  111.    *  $Log:    ntp.h,v $
  112.    * Revision 3.4.1.4  89/03/31  16:34:50  louie
  113.    * Add bit in flags which allow a peer to be synced to.  Changed a char to a bit
  114.    * field so that it is always signed.
  115. --- 1,12 ----
  116. ! /* $Source: /usr/users/louie/ntp/RCS/ntp.h,v $ $Revision: 3.4.1.5 $ $Date: 89/04/10 15:55:42 $ */
  117.   
  118.   /*
  119.    *  $Log:    ntp.h,v $
  120. +  * Revision 3.4.1.5  89/04/10  15:55:42  louie
  121. +  * Provide default value for number of bits/byte if not defined.  Compute the
  122. +  * Window shift mask inside of conditional code on XTAL so we get the correct
  123. +  * value if configured without a crystal controled clock (!!)
  124. +  * 
  125.    * Revision 3.4.1.4  89/03/31  16:34:50  louie
  126.    * Add bit in flags which allow a peer to be synced to.  Changed a char to a bit
  127.    * field so that it is always signed.
  128. ***************
  129. *** 63,68 ****
  130. --- 68,77 ----
  131.   #define FD_ZERO(p)    bzero((char *)(p), sizeof(*(p)))
  132.   #endif
  133.   
  134. + #ifndef    NBBY
  135. + #define    NBBY    8    /* number of bits per byte */
  136. + #endif
  137.   #define    MAXNETIF    10
  138.   
  139.   struct intf {
  140. ***************
  141. *** 136,147 ****
  142.   
  143.   #if    XTAL == 0
  144.   #define    PEER_SHIFT    4
  145.   #else
  146.   #define    PEER_SHIFT    8
  147.   #endif
  148.   
  149. - #define    NTP_WINDOW_SHIFT_MASK 0xff
  150. - #define    PEER_SHIFT_MASK    0xff    /* 2^PEER_SHIFT - 1 */
  151.   
  152.   /*
  153.    *  5.1 Uniform Phase Adjustments
  154. --- 145,156 ----
  155.   
  156.   #if    XTAL == 0
  157.   #define    PEER_SHIFT    4
  158. + #define    NTP_WINDOW_SHIFT_MASK 0x0f
  159.   #else
  160.   #define    PEER_SHIFT    8
  161. + #define    NTP_WINDOW_SHIFT_MASK 0xff
  162.   #endif
  163.   
  164.   
  165.   /*
  166.    *  5.1 Uniform Phase Adjustments
  167.  
  168. Index: ntp_proto.c
  169. *** ntp_proto.c.old    Mon Apr 10 15:59:10 1989
  170. --- ntp_proto.c    Mon Apr 10 15:59:13 1989
  171. ***************
  172. *** 1,5 ****
  173.   #ifndef    lint
  174. ! static char *rcsid = "$Source: /usr/users/louie/ntp/RCS/ntp_proto.c,v $ $Revision: 3.4.1.7 $ $Date: 89/04/08 10:36:53 $";
  175.   #endif
  176.   
  177.   /*
  178. --- 1,5 ----
  179.   #ifndef    lint
  180. ! static char *rcsid = "$Source: /usr/users/louie/ntp/RCS/ntp_proto.c,v $ $Revision: 3.4.1.8 $ $Date: 89/04/10 15:57:59 $";
  181.   #endif
  182.   
  183.   /*
  184. ***************
  185. *** 11,16 ****
  186. --- 11,22 ----
  187.   
  188.   /*
  189.    * $Log:    ntp_proto.c,v $
  190. +  * Revision 3.4.1.8  89/04/10  15:57:59  louie
  191. +  * New -l option for ntpd to enable logging for clock adjust messages.  Changed
  192. +  * our idea of a bogus packet in the packet procedure to include a packet received
  193. +  * before a poll is sent.  Fix stupid bug in delay computation having to do with
  194. +  * peer->precision.
  195. +  * 
  196.    * Revision 3.4.1.7  89/04/08  10:36:53  louie
  197.    * The syslog message for peer selection had to be moved to account for the
  198.    * anti-peer flapping code just installed.
  199. ***************
  200. *** 119,125 ****
  201.   extern int debug;
  202.   extern void dump_pkt();
  203.   #endif
  204. ! extern int trusting;
  205.   extern struct sysdata sys;
  206.   extern struct list peer_list;
  207.   extern struct ntp_peer *check_peer();
  208. --- 125,131 ----
  209.   extern int debug;
  210.   extern void dump_pkt();
  211.   #endif
  212. ! extern int trusting, logstats;
  213.   extern struct sysdata sys;
  214.   extern struct list peer_list;
  215.   extern struct ntp_peer *check_peer();
  216. ***************
  217. *** 217,223 ****
  218.   
  219.       if (i && peer->reach == 0) {
  220.           syslog(LOG_INFO, "Lost reachability with %s",
  221. !                ntoa(peer->src.sin_addr));
  222.   #ifdef    DEBUG
  223.           if (debug)
  224.               printf("Lost reachability with %s",
  225. --- 223,229 ----
  226.   
  227.       if (i && peer->reach == 0) {
  228.           syslog(LOG_INFO, "Lost reachability with %s",
  229. !                    ntoa(peer->src.sin_addr));
  230.   #ifdef    DEBUG
  231.           if (debug)
  232.               printf("Lost reachability with %s",
  233. ***************
  234. *** 450,456 ****
  235.   
  236.       bogus = ((pkt->org.int_part != peer->xmt.int_part) ||
  237.            (pkt->org.fraction != peer->xmt.fraction))
  238. !         && (peer->xmt.int_part != 0);
  239.   
  240.       peer->pkt_rcvd++;
  241.       peer->leap = pkt->status & LEAPMASK;
  242. --- 456,462 ----
  243.   
  244.       bogus = ((pkt->org.int_part != peer->xmt.int_part) ||
  245.            (pkt->org.fraction != peer->xmt.fraction))
  246. !         || (peer->xmt.int_part == 0);
  247.   
  248.       peer->pkt_rcvd++;
  249.       peer->leap = pkt->status & LEAPMASK;
  250. ***************
  251. *** 496,502 ****
  252.       offset = ((t2 - t1) + (t3 - t4)) / 2.0;
  253.   
  254.       delay += NTP_MAXSKW + 1.0/(unsigned long)(1L << -sys.precision);
  255. !     if (-peer->precision < sizeof(long))
  256.           delay += 1.0/(unsigned long)(1L << -peer->precision);
  257.   
  258.       if (delay < 0.0) {
  259. --- 502,508 ----
  260.       offset = ((t2 - t1) + (t3 - t4)) / 2.0;
  261.   
  262.       delay += NTP_MAXSKW + 1.0/(unsigned long)(1L << -sys.precision);
  263. !     if (peer->precision < 0 && -peer->precision < sizeof(long)*NBBY)
  264.           delay += 1.0/(unsigned long)(1L << -peer->precision);
  265.   
  266.       if (delay < 0.0) {
  267. ***************
  268. *** 591,604 ****
  269.           clock_watchdog = 0;    /* reset watchdog timer */
  270.           if (adj_logical(peer->estoffset) > 0) {
  271.               register struct ntp_peer *p = peer_list.head;
  272.               /* did you know syslog only took 4 parameters? */
  273.               sprintf(buf,
  274. !                "adjust: STEP %s st %d off %f drft %f cmpl %f",
  275.                   inet_ntoa(peer->src.sin_addr), peer->stratum,
  276.                   peer->estoffset, drift_comp, compliance);
  277.               syslog(LOG_INFO, buf);
  278.   #ifdef    DEBUG
  279.               if (debug)
  280.                   printf("Clockset from %s stratum %d offset %f\n",
  281. --- 597,608 ----
  282.           clock_watchdog = 0;    /* reset watchdog timer */
  283.           if (adj_logical(peer->estoffset) > 0) {
  284.               register struct ntp_peer *p = peer_list.head;
  285.               /* did you know syslog only took 4 parameters? */
  286.               sprintf(buf,
  287. !                     "adjust: STEP %s st %d off %f drft %f cmpl %f",
  288.                   inet_ntoa(peer->src.sin_addr), peer->stratum,
  289.                   peer->estoffset, drift_comp, compliance);
  290.               syslog(LOG_INFO, buf);
  291.   #ifdef    DEBUG
  292.               if (debug)
  293.                   printf("Clockset from %s stratum %d offset %f\n",
  294. ***************
  295. *** 616,626 ****
  296.                   printf("clock_updates: STEP ADJ\n");
  297.   #endif
  298.           } else {
  299. !             sprintf(buf,
  300. !                "adjust: SLEW %s st %d off %f drft %f cmpl %f",
  301. !                 inet_ntoa(peer->src.sin_addr), peer->stratum,
  302. !                 peer->estoffset, drift_comp, compliance);
  303. !             syslog(LOG_INFO, buf);
  304.           }
  305.       }
  306.   }
  307. --- 620,634 ----
  308.                   printf("clock_updates: STEP ADJ\n");
  309.   #endif
  310.           } else {
  311. !             if (logstats) {
  312. !                 sprintf(buf,
  313. !                     "adjust: SLEW %s st %d off %f drft %f cmpl %f",
  314. !                     inet_ntoa(peer->src.sin_addr),
  315. !                     peer->stratum,
  316. !                     peer->estoffset, drift_comp,
  317. !                     compliance);
  318. !                 syslog(LOG_INFO, buf);
  319. !             }
  320.           }
  321.       }
  322.   }
  323. ***************
  324. *** 1001,1007 ****
  325.                   1.0/(unsigned long)(1L << -sys.precision);
  326.   
  327.               /* make sure we don't try to divide by zero */
  328. !             if (-sel_lst[0].peer->precision < sizeof(long))
  329.                   threshold += 1.0/(unsigned long)
  330.                       (1L << -sel_lst[0].peer->precision);
  331.   
  332. --- 1009,1015 ----
  333.                   1.0/(unsigned long)(1L << -sys.precision);
  334.   
  335.               /* make sure we don't try to divide by zero */
  336. !             if (-sel_lst[0].peer->precision < sizeof(long)*NBBY)
  337.                   threshold += 1.0/(unsigned long)
  338.                       (1L << -sel_lst[0].peer->precision);
  339.   
  340.  
  341. Index: ntpd.c
  342. *** ntpd.c.old    Mon Apr 10 15:59:22 1989
  343. --- ntpd.c    Mon Apr 10 15:59:25 1989
  344. ***************
  345. *** 1,9 ****
  346.   #ifndef    lint
  347. ! static char *rcsid = "$Source: /usr/users/louie/ntp/RCS/ntpd.c,v $ $Revision: 3.4.1.6 $ $Date: 89/04/07 19:09:04 $";
  348.   #endif    lint
  349.   
  350.   /*
  351.    *  $Log:    ntpd.c,v $
  352.    * Revision 3.4.1.6  89/04/07  19:09:04  louie
  353.    * Added NOSWAP code for Ultrix systems to lock NTP process in memory.  Deleted
  354.    * unused variable in ntpd.c
  355. --- 1,12 ----
  356.   #ifndef    lint
  357. ! static char *rcsid = "$Source: /usr/users/louie/ntp/RCS/ntpd.c,v $ $Revision: 3.4.1.7 $ $Date: 89/04/10 15:58:45 $";
  358.   #endif    lint
  359.   
  360.   /*
  361.    *  $Log:    ntpd.c,v $
  362. +  * Revision 3.4.1.7  89/04/10  15:58:45  louie
  363. +  * Add -l option to enable logging of clock adjust messages.
  364. +  * 
  365.    * Revision 3.4.1.6  89/04/07  19:09:04  louie
  366.    * Added NOSWAP code for Ultrix systems to lock NTP process in memory.  Deleted
  367.    * unused variable in ntpd.c
  368. ***************
  369. *** 130,135 ****
  370. --- 133,139 ----
  371.   int ticked;
  372.   int selfds;
  373.   int trusting = 1;
  374. + int logstats;
  375.   
  376.   double WayTooBig = WAYTOOBIG;
  377.   unsigned long clock_watchdog;
  378. ***************
  379. *** 168,174 ****
  380.                      then allow others to override default
  381.                      values */
  382.       prog_name = argv[0];
  383. !     while ((cc = getopt(argc, argv, "a:c:dD:stn")) != EOF) {
  384.           switch (cc) {
  385.           case 'a':
  386.               if (strcmp(optarg, "any") == 0)
  387. --- 172,178 ----
  388.                      then allow others to override default
  389.                      values */
  390.       prog_name = argv[0];
  391. !     while ((cc = getopt(argc, argv, "a:c:dD:lstn")) != EOF) {
  392.           switch (cc) {
  393.           case 'a':
  394.               if (strcmp(optarg, "any") == 0)
  395. ***************
  396. *** 217,222 ****
  397. --- 221,230 ----
  398.   #endif
  399.               break;
  400.   
  401. +         case 'l':
  402. +             logstats = 1;
  403. +             break;
  404.           case 'c':
  405.               conf = optarg;
  406.               break;
  407. ***************
  408. *** 267,278 ****
  409.           setlogmask(LOG_UPTO(LOG_INFO));
  410.   #endif    /* LOG_DAEMON */
  411.   
  412. !     syslog(LOG_NOTICE, "%s version $Revision: 3.4.1.6 $", prog_name);
  413.       syslog(LOG_NOTICE, "patchlevel %d", PATCHLEVEL);
  414.   
  415.   #ifdef    DEBUG
  416.       if (debug)
  417. !         printf("%s version $Revision: 3.4.1.6 $ patchlevel %d\n",
  418.                  prog_name, PATCHLEVEL);
  419.   #endif
  420.       (void) setpriority(PRIO_PROCESS, 0, -10);
  421. --- 275,286 ----
  422.           setlogmask(LOG_UPTO(LOG_INFO));
  423.   #endif    /* LOG_DAEMON */
  424.   
  425. !     syslog(LOG_NOTICE, "%s version $Revision: 3.4.1.7 $", prog_name);
  426.       syslog(LOG_NOTICE, "patchlevel %d", PATCHLEVEL);
  427.   
  428.   #ifdef    DEBUG
  429.       if (debug)
  430. !         printf("%s version $Revision: 3.4.1.7 $ patchlevel %d\n",
  431.                  prog_name, PATCHLEVEL);
  432.   #endif
  433.       (void) setpriority(PRIO_PROCESS, 0, -10);
  434.